import axios from "axios";
import {Message} from "element-ui";

const request = axios.create({
  baseURL: "/api",
  withCredentials:true
})

request.interceptors.response.use(

  response => {
    if(response.data.status !== 200){
      Message({
        message: response.data.message,
        type: 'error',
        duration: 2 * 1000
      })
    }else{
      return response
    }
  },
);

export default request;
